<!--suppress ALL -->
<include file="./Template/header.html" />

<link rel="stylesheet" type="text/css" href="/Template/css/exam.css">
<script type="text/javascript" src="/Template/js/amazeui.js"></script>
<script type="text/javascript">


    $(function() {

        //初始化页面配置
        initPage("测量对线");

        var app = new Vue({
            el: '#container',
            data: {
            },
            methods: {
                checkRole: function(employeeRoleId, roleId) {
                    var employeeRoleArr = employeeRoleId.split(",");
                    var roleArr = roleId.split(",");

                    var result = false;
                    $.each(roleArr, function(i,val){
                        if($.inArray(val, employeeRoleArr) != -1 || $.inArray((parseInt(val)+100).toString(), employeeRoleArr) != -1){
                            result = true;
                        }
                    });
                    return result;
                },
                cancel: function() {
                    window.location.href = "/wechat/workorder/index/id/{$workorderId}";
                },
                save: function() {
                    var examMeasureId = $("input[name=examMeasureId]").val();
                    var workorderId = $("input[name=workorderId]").val();

                    var burden = $("select[name=burden]").val();
                    var em0 = $("input[name=em0]").val();
                    var em1 = $("input[name=em1]").val();
                    var em2 = $("input[name=em2]").val();
                    var em3 = $("input[name=em3]").val();
                    var em4 = $("input[name=em4]").val();
                    var em5 = $("input[name=em5]").val();
                    var em6 = $("input[name=em6]").val();
                    var em7 = $("input[name=em7]").val();
                    var em8 = $("input[name=em8]").val();
                    var em9 = $("input[name=em9]").val();
                    var em10 = $("input[name=em10]").val();
                    var em11 = $("input[name=em11]").val();
                    var em12 = $("input[name=em12]").val();
                    var em13 = $("input[name=em13]").val();
                    var em14 = $("input[name=em14]").val();
                    var em15 = $("input[name=em15]").val();
                    var em16 = $("input[name=em16]").val();
                    var em17 = $("input[name=em17]").val();
                    var em18 = $("input[name=em18]").val();
                    var em19 = $("input[name=em19]").val();
                    var em20 = $("input[name=em20]").val();
                    var em21 = $("input[name=em21]").val();
                    var em22 = $("input[name=em22]").val();
                    var em23 = $("input[name=em23]").val();
                    var em24 = $("input[name=em24]").val();


                    var completed = "1";
                    if(isNullOrEmpty(burden
                            && em0
                            && em1
                            && em2
                            && em3
                            && em4
                            && em5
                            && em6
                            && em7
                            && em8
                            && em9
                            && em10
                            && em11
                            && em12
                            && em13
                            && em14
                            && em15
                            && em16
                            && em17
                            && em18
                            && em19
                            && em20
                            && em21
                            && em22
                            && em23
                            && em24
                        )) {
                        completed = "-1";
                    }
                    if(isNullOrEmpty(burden)) {
                        alert("请选择负重状态");
                        return false;
                    }

                    $.ajax({
                        url:"/wechat/workorder/examMeasureKafoPost",
                        type:"post",
                        data:{
                            examMeasureId: examMeasureId,
                            workorderId: workorderId,
                            burden: burden,
                            em0: em0,
                            em1: em1,
                            em2: em2,
                            em3: em3,
                            em4: em4,
                            em5: em5,
                            em6: em6,
                            em7: em7,
                            em8: em8,
                            em9: em9,
                            em10: em10,
                            em11: em11,
                            em12: em12,
                            em13: em13,
                            em14: em14,
                            em15: em15,
                            em16: em16,
                            em17: em17,
                            em18: em18,
                            em19: em19,
                            em20: em20,
                            em21: em21,
                            em22: em22,
                            em23: em23,
                            em24: em24,

                            completed:completed,
                        },
                        dataType:"JSON",
                        beforefootSend:function(){
                            $("#loadingToast").show();
                        },
                        complete:function(){
                            $('#loadingToast').hide();
                        },
                        success:function(data){
                            if(data.code == 200) {
//                                alert(data.alert);
                                alert("保存成功");
                                window.location.href = "/wechat/workorder/index/id/{$workorderId}";
                            }
                        },
                    })

                }
            }
        })
        $(".item select").change(function() {
            var value = $(this).find("option:selected").text();
            $(this).prev().val(value);
        });
    })

</script>

<div class="container" id="container">
    <div class="hint-info">
        <span class="update_time">{$formDict.update_time}：{$examMeasure.update_time}</span>
        <span class="employee_name">{$formDict.update_name}：{$employeeName}</span>
    </div>

    <div class="edit-info">
        <div class="edit-content">
            <input type="text" style="display: none;" name="workorderId" value="{$workorderId}">
            <input type="text" style="display: none;" name="examMeasureId" value="{$examMeasureId}">
            <div class="item">
                <span style="color: #ed7667; font-weight: bold">负重状态：</span>
                <input id="burden" type="text" value="{$examMeasure.burden}" readonly placeholder="请选择">
                <select name="burden">
                    <option value="{$examMeasure.burden}">请选择</option>
                    {:getFormDictSelectOption($examMeasure['burden'],'burden','exam_measure',0)}
                </select>
                <img class="icon-right" src="/Template/images/icon-right.png" alt="">
            </div>
            <if condition="$workorder['workorder_type'] eq '5'">
                <img class="bg-img" src="http://xwk-file.oss-cn-qingdao.aliyuncs.com/Home/exam_KAFO_wechat.jpg" alt="bg">
            </if>
            <if condition="$workorder['workorder_type'] eq '6'">
                <img class="bg-img" src="http://xwk-file.oss-cn-qingdao.aliyuncs.com/Home/exam_KO_wechat.jpg" alt="bg">
            </if>
            <div class="item" style="border-bottom:0px"><span>1.坐骨结节到地面高度:</span><input name="em0" type="text" value="{$examMeasure.em0}" placeholder="请输入数据(mm)" ></div>
            <div class="item" style="border-bottom:0px"><span>2.耻骨联合到地面高度:</span><input name="em1" type="text" value="{$examMeasure.em1}" placeholder="请输入数据(mm)" ></div>
            <div class="item" style="border-bottom:0px"><span style="width: 65%;">3.膝关节中心到地面高度:</span><input  style="width: 32%;" name="em2" type="text" value="{$examMeasure.em2}" placeholder="请输入数据(mm)" ></div>
            <div class="item" style="border-bottom:0px"><span>4.髌骨下沿宽度:</span><input name="em3" type="text" value="{$examMeasure.em3}" placeholder="请输入数据(mm)" ></div>
            <div class="item" style="border-bottom:0px"><span>5.腓骨颈到地面高度:</span><input name="em4" type="text" value="{$examMeasure.em4}" placeholder="请输入数据(mm)" ></div>
            <div class="item" style="border-bottom:0px"><span>6.会阴处大腿宽度:</span><input name="em5" type="text" value="{$examMeasure.em5}" placeholder="请输入数据(mm)" ></div>
            <div class="item" style="border-bottom:0px"><span>7.会阴处大腿围长:</span><input name="em6" type="text" value="{$examMeasure.em6}" placeholder="请输入数据(mm)" ></div>
            <div class="item" style="border-bottom:0px"><span>8.股骨中段处宽度:</span><input name="em7" type="text" value="{$examMeasure.em7}" placeholder="请输入数据(mm)" ></div>
            <div class="item" style="border-bottom:0px"><span>9.股骨中段处围长:</span><input name="em8" type="text" value="{$examMeasure.em8}" placeholder="请输入数据(mm)" ></div>
            <div class="item" style="border-bottom:0px"><span>10.股骨远端处宽度:</span><input name="em9" type="text" value="{$examMeasure.em9}" placeholder="请输入数据(mm)" ></div>
            <div class="item" style="border-bottom:0px"><span>11.股骨远端处围长:</span><input name="em10" type="text" value="{$examMeasure.em10}" placeholder="请输入数据(mm)" ></div>
            <div class="item" style="border-bottom:0px"><span>12.膝关节中心宽度:</span><input name="em11" type="text" value="{$examMeasure.em11}" placeholder="请输入数据(mm)" ></div>
            <div class="item" style="border-bottom:0px"><span>13.膝关节中心围长:</span><input name="em12" type="text" value="{$examMeasure.em12}" placeholder="请输入数据(mm)" ></div>
            <div class="item" style="border-bottom:0px"><span>14.小腿最粗处宽度:</span><input name="em13" type="text" value="{$examMeasure.em13}" placeholder="请输入数据(mm)" ></div>
            <div class="item" style="border-bottom:0px"><span>15.小腿最粗处围长:</span><input name="em14" type="text" value="{$examMeasure.em14}" placeholder="请输入数据(mm)" ></div>
            <div class="item" style="border-bottom:0px"><span>16.小腿最细处宽度:</span><input name="em15" type="text" value="{$examMeasure.em15}" placeholder="请输入数据(mm)" ></div>
            <div class="item" style="border-bottom:0px"><span>17.小腿最细处围长:</span><input name="em16" type="text" value="{$examMeasure.em16}" placeholder="请输入数据(mm)" ></div>
            <div class="item" style="border-bottom:0px"><span>18.踝关节宽度:</span><input name="em17" type="text" value="{$examMeasure.em17}" placeholder="请输入数据(mm)" ></div>
            <div class="item" style="border-bottom:0px"><span>19.踝关节围长:</span><input name="em18" type="text" value="{$examMeasure.em18}" placeholder="请输入数据(mm)" ></div>
            <if condition="$workorder['workorder_type'] eq '5'">
                <!--div class="item" style="border-bottom:0px"><span>20.KAFO高度:</span><input name="em19" type="text" value="{$examMeasure.em19}" placeholder="请输入数据(mm)" ></div-->
                <div class="item"><span>20.跖趾关节宽度:</span><input name="em24" type="text" value="{$examMeasure.em24}" placeholder="请输入数据(mm)" ></div>
                <div class="item"><span>髂嵴围长:</span><input name="em20" type="text" value="{$examMeasure.em20}" placeholder="请输入数据(mm)" ></div>
                <div class="item"><span>大转子围长:</span><input name="em21" type="text" value="{$examMeasure.em21}" placeholder="请输入数据(mm)" ></div>
                <div class="item"><span>髂嵴到大转子高度:</span><input name="em22" type="text" value="{$examMeasure.em22}" placeholder="请输入数据(mm)" ></div>
                <div class="item" style="border-bottom:0px"><span>腰部到膝关节高度:</span><input name="em23" type="text" value="{$examMeasure.em23}" placeholder="请输入数据(mm)" ></div>
            </if>
            <!--if condition="$workorder['workorder_type'] eq '6'">
                <div class="item"><span>20.KO高度:</span><input name="em19" type="text" value="{$examMeasure.em19}" placeholder="请输入数据(mm)" ></div>
            </if-->


            <div class="line"></div>
        </div>
    </div>
    <div class="operation-btn">
        <div class="cancle-btn" v-on:click="cancel">取消</div>
        <if condition="$workorder['status'] lt '2' && $workorder['creator_id'] eq $customerId">
            <div class="save-btn" v-on:click="save">保存</div>
        </if>
        <div v-if="{$workorder.status} >= 1 && checkRole('{$role}', '1')">
            <div class="save-btn" v-on:click="save">保存</div>
        </div>
        <!--if condition="$workorder['status'] eq '2' && $workorder['examinator_id'] eq $customerId && $workorder['exam_time'] eq ''">
            <div class="save-btn" v-on:click="save">保存</div>
        </if-->
    </div>

</div>
<include file="./Template/footer.html" />